<template>
    <div class="meat">
      <!-- 一级菜单下面所拥有的二级菜单 -->
      <el-aside class="aside" :width="isCollapse ? '50px' : '200px'">
        <i
          class="el-icon-s-fold toggle-button"
          @click="toggleCollapse"
          v-if="isCollapse == false"
        ></i>
        <i
          class="el-icon-s-unfold toggle-button"
          @click="toggleCollapse"
          v-else
        ></i>
        <el-menu
        ref="menu"
          :default-active="activePath"
          router
          unique-opened
  
          :collapse-transition="false"
          :collapse="isCollapse"
          class="sidebar el-menu-vertical-demo"
          @select="openMenu"
          text-color="#A9B0B7"
          active-text-color="#0064F1"
        >
          <menu-tree :menuData="treeData"></menu-tree>
  
        </el-menu>
      </el-aside>
      <!-- 以及二级菜单所对应的页面 -->
      <el-main class="main_container">
        <router-view></router-view>
      </el-main>
    </div>
  </template>
  
  <script>
  import menuTree from "@/components/commonPublic/menu.vue";

  export default {
    components: {
      // SideMenu
      menuTree,
    },
    data() {
      return {
       
        // activePath: "entryLedger",
        activePath: "",
  
        isCollapse: false,
        // 材料质量管控
        treeData: [
          // 原材料管理
          {
            title: "进场材料管理",
            img: "iconfont icon-xitongguanli1",
            name: "rawMaterialManage",
            left:0,
            children: [
              {
                title: "材料进场台帐",
                path: "entryLedger",
                path2: "entryLedgerText",
                name: "entryLedger",
                name2: "entryLedgerText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
              },
              {
                title: "材料检测台帐",
                path: "inspectionLedger",
                path2: "",
                name: "inspectionLedger",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
            ],
          },
          // 见证取样管理
          {
            title: "见证取样管理",
            img: "iconfont icon-xitongguanli1",
            name: "sampleManage",
            children: [
              {
                title: "现场见证取样",
                path: "/fieldSampling",
                path2: "fieldSamplingText",
                name: "fieldSampling",
                name2: "fieldSamplingText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "样品室内收样",
                path: "/collection",
                path2: "collectionText",
                name: "collection",
                name2: "collectionText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "材料检测委托单",
                path: "/sampleMaterial",
                path2: "sampleMaterialText",
                name: "sampleMaterial",
                name2: "sampleMaterialText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
            ],
          },
          // 试验检测管理
          {
            rank: 1,
            title: "试验检测管理",
            img: "iconfont icon-xitongguanli1",
            name: "testDetectionManage",
            left:0,
            children: [
              {
                title: "备案信息管理",
                 //1只有查看    2带编辑页
                path: "/filing",
                path2: "/",
                name: "filing",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
  
                left:37
  
              },
              {
                title: "样品登记台帐",
                 //1只有查看    2带编辑页
                path: "/samplesLedger",
                path2: "",
                name: "samplesLedger",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "检测报告台帐",
                 //1只有查看    2带编辑页
                path: "/testingLedger",
                path2: "",
                name: "testingLedger",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "不合格报告管理",
                 //1只有查看    2带编辑页
                path: "/unqualifiedReport",
                path2: "",
                name: "unqualifiedReport",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
  
              {
                title: "材料报验单管理",
                path: "/InspectionForm",
                path2: "InspectionFormText",
                name: "InspectionForm",
                name2: "InspectionFormText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
            ],
          },
          // 外委检测管理
          {
            rank: 1,
            title: "外委检测管理",
            img: "iconfont icon-xitongguanli1",
            name: "outsourcedManage",
            left:0,
            children: [
              {
                title: "外委样品管理",
                path: "/outsourcedSample",
                path2: "/outsourcedSampleText",
                name: "outsourcedSample",
                name2: "outsourcedSampleText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "外委报告管理",
                path: "/qualificationReport",
                path2: "qualificationReportText",
                name: "qualificationReport",
                name2: "qualificationReportText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "不合格报告管理",
                path: "/outUnQualifiedReports",
                path2: "outUnQualifiedReportsText",
                name: "outUnQualifiedReports",
                name2: "outUnQualifiedReportsText",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
            ],
          },
          // 智能养护管理
          {
            rank: 1,
            title: "智能养护管理",
            img: "iconfont icon-xitongguanli1",
            name: "intelligentMaintenanceManage",
            left:0,
            children: [
              {
                title: "试件入库管理",
                path: "/sampleStorage",
                path2: "",
                name: "sampleStorage",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "试件出库管理",
                path: "/sampleOutbound",
                path2: "",
                name: "sampleOutbound",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
              {
                title: "温湿度在线监控",
                path: "/temperature&humidity",
                path2: "",
                name: "temperature&humidity",
                name2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                left:37
  
              },
            ],
          },
          // 试验机联网
          {
            rank: 1,
            title: "试验机联网监管",
            img: "iconfont icon-xitongguanli1",
            name: "machineNetworkManage",
            left:0,
            children: [
              {
                path: "/sampleTestedManage",
                path2: "",
                img: "iconfont icon-shengchanguanli1",
                children: [],
                title: "待试验样品",
                name: "sampleTestedManage",
                left:37
  
              },
  
              {
                title: "试验数据监控",
                
                name: "testDataMonitorManage",
                img: "iconfont icon-gongcheng",
                left:25,
                children: [
                  {
                    title: "压力机数据监控",
                    path: "/pressDataMonitor",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "pressDataMonitor",
                    left:60,
                  },
  
                  {
                    title: "万能机数据监控",
                    path: "/zigzagDataMonitor",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "zigzagDataMonitor",
                    left:60,
  
                  },
                  {
                    title: "抗折抗压机数据监控",
                    path: "/compressivePressDataMonitor",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "compressivePressDataMonitor",
                    left:60,
                  },
                  {
                    title: "沥青设备监控",
                    
                    img: "iconfont icon-shengchengbaogao",
                    name: "asphaltEquipmentMonitor",
                    left:45,
                    children: [
                      {
                        title: "针入度",
                        path: "/penetrationMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "penetrationMonitor",
                        left:80,
                      },
  
                      {
                        title: "软化点",
                        path: "/softenPointMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "softenPointMonitor",
                        left:80,
  
                      },
                      {
                        title: "延度",
                        path: "/ductilityMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "ductilityMonitor",
                        left:80,
  
                      },
                    ],
                  },
                  {
                    title: "沥青混合料监控",
                    
                    img: "iconfont icon-shengchengbaogao",
  
                    name: "asphaltMixtureMonitor",
                    left:45,
                    children: [
                      {
                        title: "稳定度",
                        path: "/stabilityMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "stabilityMonitor",
                        left:80,
                      },
  
                      {
                        title: "沥青含量",
                        path: "/asphaltContentMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "asphaltContentMonitor",
                        left:80,
                      },
                      {
                        title: "车辙",
                        path: "/rutMonitor",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "rutMonitor",
                        left:80,
                      },
                    ],
                  },
                ],
              },
              {
                title: "试验数据处理",
                name: "testDataProcessManage",
                img: "iconfont icon-gongcheng",
                left:25,
                children: [
                  {
                    title: "压力机数据处理",
                    path: "/pressDataProcess",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "pressDataProcess",
                    left:60,
                  },
  
                  {
                    title: "万能机数据处理",
                    path: "/zigzagDataProcess",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "zigzagDataProcess",
                    left:60,
                  },
                  {
                    title: "抗折抗压机数据处理",
                    path: "/compressivePressDataProcess",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "compressivePressDataProcess",
                    left:60,
                  },
                  {
                    title: "沥青设备处理",
                    img: "iconfont icon-shengchengbaogao",
                    name: "asphaltEquipmentProcess",
                    left:45,
                    children: [
                      {
                        title: "针入度",
                        path: "/penetrationProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "penetrationProcess",
                        left:80,
                      },
  
                      {
                        title: "软化点",
                        path: "/softenPointProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "softenPointProcess",
                        left:80,
  
                      },
                      {
                        title: "延度",
                        path: "/ductilityProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "ductilityProcess",
                        left:80,
  
                      },
                    ],
                  },
                  {
                    title: "沥青混合料处理",
                    img: "iconfont icon-shengchengbaogao",
                    name: "asphaltMixtureProcess",
                    left:45,
                    children: [
                      {
                        title: "稳定度",
                        path: "/stabilityProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "stabilityProcess",
                        left:80,
  
                      },
  
                      {
                        title: "沥青含量",
                        path: "/asphaltContentProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "asphaltContentProcess",
                        left:80,
  
                      },
                      {
                        title: "车辙",
                        path: "/rutProcess",
                        path2: "",
                        img: "iconfont icon-cailiaozhengli",
                        children: [],
                        name: "rutProcess",
                        left:80,
  
                      },
                    ],
                  },
                ],
              },
              {
                title: "数据统计分析",
                name: "analysisDataManage",
                img: "iconfont icon-gongcheng",
                left:25,
                children: [
                  {
                    title: "混凝土质量趋势",
                    path: "/concreteQuality",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "concreteQuality",
                    left:60,
                  },
  
                  {
                    title: "钢筋质量趋势",
                    path: "/rebarQuality",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "rebarQuality",
                    left:60,
  
                  },
                  {
                    title: "水泥质量趋势",
                    path: "/cementQuality",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "cementQuality",
                    left:60,
  
                  },
                  {
                    title: "砂浆质量趋势",
                    path: "/mortarQuality",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "mortarQuality",
                    left:60,
  
                  },
                  {
                    title: "净浆质量趋势",
                    path: "/pasteQuality",
                    path2: "",
                    img: "iconfont icon-cailiaozhengli",
                    children: [],
                    name: "pasteQuality",
                    left:60,
  
                  },
                ],
              },
            ],
          },
        ],
      };
    },
    watch: {
      activePath() {
       
        this.activePath =  sessionStorage.getItem("yjSmart-keyPath");
    
      },
    },
    mounted() {
  //  this.$refs.kzMenu.activedIndex = path;
      // defaultMenu
      this.activePath =
        sessionStorage.getItem("yjSmart-keyPath") || "entryLedger";
    },
    methods: {
      // 左侧菜单是否显示
      toggleCollapse() {
        this.isCollapse = !this.isCollapse;
      },
      openMenu(keyPath) {
  
        //  window.sessionStorage.setItem("yjSmart-materiaMange-meun", keyPath);
        if (keyPath != "null") {
          sessionStorage.setItem("yjSmart-keyPath", keyPath);
        }
      },
      handleNodeClick(data) {
        console.log(data, 3333);
      },
  
    },
  };
  </script>
  